
*Set sub-directory paths--same for all users:
global stay_at_home_raw "${machine}/data/raw/stay_at_home"
global stay_at_home "${machine}/data/clean/stay_at_home"
global tables "${machine}/tables/"
global figures "${machine}/figures/"
*global save_data "${machine}/social_distance/data"
global weather_raw "${machine}/data/raw/weather"
global weather "${machine}/data/clean/weather"


use "${stay_at_home}/reopenings.dta", clear
tempfile for_weather
keep stateabb statefip
rename statefip state_fips
duplicates drop
save `for_weather', replace


use "${stay_at_home}/reopenings.dta", clear


levelsof stateabb, local(levels) 
clear

foreach l of local levels {
tempfile `l'
display "`l'"
import excel "${weather_raw}/state_daily.xls", sheet("`l'") firstrow
keep if year==2020
compress
gen state="`l'"
save ``l'', replace
clear
}

foreach l of local levels {
append using ``l''
display "`l'"
}


rename state stateabb

merge m:1 stateabb using `for_weather'
drop _merge

gen date_mdy=mdy(month, date, year)
format date_mdy %td
rename date day
compress
save "${weather}/state_daily_2020.dta", replace
